package com.lyz.dataStructure.LeetCode;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:34
 * @Description:
 **/

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/4/13 20:34
 *@Description:
 **/
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


/*
3
aa
b
ac
bbaac
 */
public class Main2 {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int m=input.nextInt();
        List<String> list = new ArrayList<>();
        for(int i=0;i<m;i++){
            String str = input.next();
            list.add(str);
        }
        String longStr = input.next();
        System.out.println(test(m,list,longStr));
    }
    public static int test(int m,List<String> list,String longStr){
        int count=0;
        char[] chars = longStr.toCharArray();
        for(int i=0;i<chars.length;i++){
            for(int j=0;j<list.size();j++){
                if(String.valueOf(chars[i]).equals(list.get(j))){
                    count++;
                }
            }
        }



        return count;
    }
}
